JBoss Community Archive (Read Only)

GateIn Portal 3.4

Rememberme password encryption

Introduction

Automatic login feature of GateIn Portal employs token mechanism to authenticate returning users without asking their explicit logins.

For the moment, token storage contains a security hole as user passwords are persisted in plain form. The high risk from such unsecured implementation boost us to find an encryption mechanism which:

  1. Bases on secured algorithm.

  2. Functions with secret factors created/maintained by customers.

  3. Generates not-too-long encrypted data.

based encryption

We decided to build a symmetric encryption over JCA - Java Cryptography Architecture library whose default algorithm is AES

Configuration

Default configuration entry of JCA-based encryption is declared in configuration.properties file

gatein.codec.builderclass=org.exoplatform.web.security.codec.JCASymmetricCodecBuilder
gatein.codec.config=${gatein.conf.dir}/codec/jca-symmetric-codec.properties

Detailed parameters for encryptions whose builder is org.exoplatform.web.security.codec.JCASymmetricCodecBuilder are referred in the file jca-symmetric-codec.properties

# Defailed information on JCA standard names could be found at
#
# http://docs.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html#KeyStore
#
# The file key.txt is generated via keytool util in JDK
#
# keytool -genseckey -alias "gtnKey" -keypass "gtnKeyPass" -keyalg "AES" -keysize 128 -keystore "key.txt" -storepass "gtnStorePass" -storetype "JCEKS"
#
#
gatein.codec.jca.symmetric.alias=gtnKey
gatein.codec.jca.symmetric.keypass=gtnKeyPass
gatein.codec.jca.symmetric.keyalg=AES
gatein.codec.jca.symmetric.keystore=key.txt
gatein.codec.jca.symmetric.storepass=gtnStorePass
gatein.codec.jca.symmetric.storetype=JCEKS

Customization

A crucial point of our encryption is that secret factors (algorithm, key storage, key size,...) are created/maintained on customer side, hence keep it private to them.

Below are steps to customize those secret factors in products using JCASymmmetricCodecBuilder.

Generate secret key via keytool

$JAVA_HOME/bin/keytool -genseckey -alias "customAlias" -keypass "customKeyPass" -keyalg "customAlgo" -keystore "customStore" -storepass "customStorePass" -storetype "customStoreType"

The above keytool command generates secret key stored in a file named customStore. Let's copy the file to the directory gatein/conf/codec.


NOTEs:

* The list of standard algorithms could be found here
* Extra params for keytool might be required for special algorithms.
* In JCA, only JCEKS storetype supports symmetric key.

Updates jca-symmetric-codec.properties

Remain work is updating the file jca-symmetric-codec.properties with parameters used in previous step.

gatein.codec.jca.symmetric.alias=customAlias
gatein.codec.jca.symmetric.keypass=customKeyPass
gatein.codec.jca.symmetric.keyalg=customAlgo
gatein.codec.jca.symmetric.keystore=customStore
gatein.codec.jca.symmetric.storepass=customStorePass
gatein.codec.jca.symmetric.storetype=customStoreType
JBoss.org Content Archive (Read Only), exported from JBoss Community Documentation Editor at 2020-03-10 12:45:39 UTC, last content change 2012-07-02 08:35:20 UTC.